﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;

namespace WebUI.HtmlHelpers
{
    public static class SpanActionLinkHelper
    {
        public static string SpanActionLink(this AjaxHelper helper, string innerText, string cssClass, string actionName, object routeValues, AjaxOptions ajaxOptions)
        {
            const string quote = "\"";

            var str = "<span " + "class=" + quote + cssClass + quote + ">" + innerText + "</span>";
            var link = helper.ActionLink("[replaceme]", actionName, routeValues, ajaxOptions);
            return link.ToHtmlString().Replace("[replaceme]", str);
            //return link.ToHtmlString().Replace("[replaceme]", builder.ToString(TagRenderMode.SelfClosing));
        }
    }
}